/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.hazard.alarm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.basic.common.constant.enums.ParkBasicModDictEnum;
import com.hopes.bizz.common.core.util.DateUtils;
import com.hopes.bizz.hazard.common.constant.enums.HazardModDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 危险源日报警统计
 *
 * @author daijie
 * @date 2023-11-21 10:36:17
 */
@Data
@TableName("haz_alarm_day")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "危险源日报警统计")
public class HazAlarmDayEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 危险源
     */
    @Schema(description = "危险源")
    private Long hazardSourceId;

    /**
     * 日期
     */
    @Schema(description = "日期")
    private Date analyDay;

    /**
     * 报警总数
     */
    @Schema(description = "报警总数")
    private Integer alarmNum;

    /**
     * 超标报警数
     */
    @Schema(description = "超标报警数")
    private Integer overproofNum;

    /**
     * 异常报警数
     */
    @Schema(description = "异常报警数")
    private Integer errorNum;

    /**
     * 超标时长
     */
    @Schema(description = "超标时长")
    private Integer overproofTime;

    /**
     * 断网时长
     */
    @Schema(description = "断网时长")
    private Integer brokenNetTime;

    /**
     * 断网报警数
     */
    @Schema(description = "断网报警数")
    private Integer brokenNum;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;

    public String getHazardSourceIdStr() {
        return DictResolver.getItemLabelByValue(ParkBasicModDictEnum.hazard_source, this.hazardSourceId);
    }

    public String getAnalyDayStr() {
        return DateUtils.limitDay(this.analyDay);
    }

    public String getOverproofTimeStr() {
        return this.overproofTime + "分钟";
    }

    public String getBrokenNetTimeStr() {
        return this.brokenNetTime + "分钟";
    }
}
